#-*- coding:utf-8 -*-

import pymysql

class MysqlDB():
	connection = 0
	cur = 0
	def __init__(self):
		self.connection = pymysql.connect(
		host='localhost',
		user='root',
		passwd='asdf',
		db='db_device',
		charset='utf8'
		)
		#print("Init mysql sucess")
	
	def dml(self, strSQL):
		self.cur = self.connection.cursor()
		#print(strSQL)
		self.cur.execute(strSQL)
		self.cur.close()
		self.connection.commit()

	def send(self, strSQL):
		self.cur = self.connection.cursor()
		self.cur.execute(strSQL)
		return self.cur

	def commit(self):
		self.cur.close()
		self.connection.commit()

	def close(self):
		self.connection.close()
